<pre>
<script>

// オブジェクト
var obj = { name:"hoge", width:256 };

// 要素へアクセス. 方法は２通り
document.write("-- Access element --\n");
document.write(obj.name + '\n');
document.write(obj["name"] + '\n');

// 全ての要素へアクセス
document.write("-- Access all element --\n");
for (var key in obj) {
    document.write(key + " : " + obj[key]);
    document.write('\n');
}

// 要素を追加
document.write("-- Add element --\n");
obj["height"] = 128;
for (var key in obj) {
    document.write(key + " : " + obj[key]);
    document.write('\n');
}

// 要素を削除
document.write("-- Delete element --\n");
delete obj["name"];
for (var key in obj) {
    document.write(key + " : " + obj[key]);
    document.write('\n');
}

</script>
</pre>